﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Observer
{
    /// <summary>
    /// ColorFrame.xaml 的交互逻辑
    /// </summary>
    public partial class ColorFrame : Window, IUpdate
    {
        public void OnUpdate( int i )
        {
            UpdateColorFrame( i );
        }

        public void UpdateColorFrame( int i )
        {
            SetColor( i );
        }

        public ColorFrame()
        {
            InitializeComponent();
            SetColor( 1 );
        }

        // 1, 2, 3 R G B
        public void SetColor(int Color)
        {
            switch( Color )
            {
                case 1:
                    rect.Fill = Brushes.Red;
                    ColorText.Text = "Red";
                    break;
                case 2:
                    rect.Fill = Brushes.Green;
                    ColorText.Text = "Green";
                    break;
                case 3:
                    rect.Fill = Brushes.Blue;
                    ColorText.Text = "Blue";
                    break;
            }
            
        }
    }
}
